'use strict';

import { UserType } from '../model/user'
export default () => {
  return async function(ctx, next) {
    // 获取用户数据
    const userData = await ctx.getUserData()
    ctx.userData = userData
    if (userData.type === UserType.SUPER_ADMIN) {
      await next();
    } else {
      throw '当前账号权限必须是超级管理员';
    }
  };
};
